
from django.db import models

# Create your models here.

# 权限表
class Menu(models.Model):
    title=models.CharField(verbose_name='权限名称',max_length=32)
    path=models.CharField(verbose_name='权限路径',max_length=32)
    is_menu=models.IntegerField(default=1)
    def __str__(self):
        return self.title

# 角色表
class Roles(models.Model):
    GENDER_CHOICES = (
        (0, '正常'),
        (1, '锁定')
    )
    roleName=models.CharField(verbose_name='角色名称',max_length=32)
    remark=models.CharField(verbose_name='角色备注',max_length=32,default='角色描述')
    state=models.IntegerField(choices=GENDER_CHOICES,default=0,verbose_name='角色状态')
    menu=models.ManyToManyField(to=Menu)
    def __str__(self):
        return self.roleName

# 用户表
class User(models.Model):
    username=models.CharField(verbose_name='用户名',max_length=32)
    password=models.CharField(verbose_name='密码',max_length=32,blank=True)
    profile_picture=models.URLField(verbose_name='头像',blank=True)
    rid=models.ManyToManyField(to=Roles)
    def __str__(self):
        return self.username




